package bairui.international.model.domain.jpa;

/**
 *
 * @see TB_ProductCategoryPropertyItem 产品分类属性项
 *
 */
public class TestData_TB_ProductCategoryPropertyItem
{

	private final static org.apache.commons.text.RandomStringGenerator Generator = new org.apache.commons.text.RandomStringGenerator.Builder().withinRange(new char[][]{{'a','z'}, {'A','Z'}, {'0','9'}}).build();

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ProductCategoryPropertyItem saveMust(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_ProductCategoryProperty productCategoryProperty
	,bairui.international.model.domain.jpa.TB_ProductPropertyItem productPropertyItem
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ProductCategoryPropertyItem");
		return (TB_ProductCategoryPropertyItem)repository.save(newMust(
				productCategoryProperty
				,productPropertyItem
			));
	}
	
	public static TB_ProductCategoryPropertyItem newMust(
		bairui.international.model.domain.jpa.TB_ProductCategoryProperty productCategoryProperty
	,bairui.international.model.domain.jpa.TB_ProductPropertyItem productPropertyItem
	){
		return new TB_ProductCategoryPropertyItem(new TB_ProductCategoryPropertyItem.MustProperties() {
			/** 产品分类属性 */
			@Override public bairui.international.model.domain.jpa.TB_ProductCategoryProperty getProductCategoryProperty(){
				return productCategoryProperty;
			}
			/** 产品属性项 */
			@Override public bairui.international.model.domain.jpa.TB_ProductPropertyItem getProductPropertyItem(){
				return productPropertyItem;
			}
		});
	}
	

	@SuppressWarnings({ "unchecked", "rawtypes" })
	@org.springframework.transaction.annotation.Transactional(rollbackFor=java.lang.Throwable.class)
	public static TB_ProductCategoryPropertyItem saveAll(
		org.springframework.context.ApplicationContext context,
		bairui.international.model.domain.jpa.TB_ProductCategoryProperty productCategoryProperty
	,bairui.international.model.domain.jpa.TB_ProductPropertyItem productPropertyItem
	){
		org.springframework.data.jpa.repository.JpaRepository repository = (org.springframework.data.jpa.repository.JpaRepository)context.getBean("repository_ProductCategoryPropertyItem");
		return (TB_ProductCategoryPropertyItem)repository.save(newAll(
				productCategoryProperty
				,productPropertyItem
			));
	}
	
	public static TB_ProductCategoryPropertyItem newAll(
		bairui.international.model.domain.jpa.TB_ProductCategoryProperty productCategoryProperty
	,bairui.international.model.domain.jpa.TB_ProductPropertyItem productPropertyItem
	){
		return new TB_ProductCategoryPropertyItem(
			new TB_ProductCategoryPropertyItem.MustProperties() {
				/** 产品分类属性 */
				@Override public bairui.international.model.domain.jpa.TB_ProductCategoryProperty getProductCategoryProperty(){
					return productCategoryProperty;
				}
				/** 产品属性项 */
				@Override public bairui.international.model.domain.jpa.TB_ProductPropertyItem getProductPropertyItem(){
					return productPropertyItem;
				}
			},
			new TB_ProductCategoryPropertyItem.OptionalSingleProperties() {
			}
		);
	}
	

}
